package com.jbit.dm_160.service.impl;

import com.jbit.dm_160.mapper.SchedulerSeatMapper;
import com.jbit.dm_160.mapper.SchedulerSeatPriceMapper;
import com.jbit.dm_160.model.dto.SchedulerSeatDTO;
import com.jbit.dm_160.model.dto.SchedulerSeatPriceDTO;
import com.jbit.dm_160.model.entity.SchedulerSeat;
import com.jbit.dm_160.service.SchedulerSeatPriceService;
import com.jbit.dm_160.service.SchedulerSeatService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ScheduleSeatServiceImpl implements SchedulerSeatService {
    @Resource
    private SchedulerSeatMapper schedulerSeatMapper;
    @Resource
    private SchedulerSeatPriceService schedulerSeatPriceService;
    @Override
    public List<String> getSeatArrayByScheduleId(Integer scheduleId) {
        return schedulerSeatMapper.getSeatArrayByScheduleId(scheduleId);
    }

    @Override
    public List<SchedulerSeatDTO> getSeatByScheduleId(Integer scheduleId) {
        return schedulerSeatMapper.getSeatByScheduleId(scheduleId);
    }

    @Override
    public SchedulerSeatPriceDTO getSeatPriceInfo(Integer scheduleId,Integer cinemaId) {
        SchedulerSeatPriceDTO schedulerSeatPriceDTO = new SchedulerSeatPriceDTO();
        schedulerSeatPriceDTO.setScheduleId(scheduleId);
        schedulerSeatPriceDTO.setCinemaId(cinemaId);
        schedulerSeatPriceDTO.setSeatPriceList(schedulerSeatPriceService.getSeatPriceDetailByScheduleId(scheduleId));
        schedulerSeatPriceDTO.setSeatInfoList(schedulerSeatMapper.getSeatByScheduleId(scheduleId));
        return schedulerSeatPriceDTO;
    }

    @Override
    public List<SchedulerSeatDTO> getScheduleSeatPriceByInfo(Integer scheduleId, List<SchedulerSeat> list) {
        return schedulerSeatMapper.getScheduleSeatPriceByInfo(scheduleId,list);
    }

    @Override
    public Integer updateSeatStatus(Integer scheduleId, List<SchedulerSeat> list, Integer status,String orderNo) {
        return schedulerSeatMapper.updateSeatStatus(scheduleId,list,status,orderNo);
    }
}
